package cn.iocoder.yudao.module.wms.dal.mysql.customerclassify;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.wms.controller.admin.customerclassify.vo.CustomerClassifyPageReqVO;
import cn.iocoder.yudao.module.wms.dal.dataobject.customerclassify.CustomerClassifyDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Collection;

/**
 * 客户分类 Mapper
 *
 * @author 曾劲松
 */
@Mapper
public interface CustomerClassifyMapper extends BaseMapperX<CustomerClassifyDO> {

    default PageResult<CustomerClassifyDO> selectPage(CustomerClassifyPageReqVO reqVO, Collection<Long> parentIds) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerClassifyDO>()
                .eqIfPresent(CustomerClassifyDO::getCode, reqVO.getCode())
                .likeIfPresent(CustomerClassifyDO::getName, reqVO.getName())
                .eqIfPresent(CustomerClassifyDO::getParentId, parentIds)
                .betweenIfPresent(CustomerClassifyDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CustomerClassifyDO::getId));
    }

}